(function() {
            var foodType = ["fastFood", "local dish"];
            
            $(document).ready(function() {
                $.ajax({
                    url : "http://localhost:8080/ContentServletMock",
                    method : "GET",
                    success : function(data) {                
                        var protocal = JSON.parse(data);
                        var status = protocal.status;                       
                        if (status == "Success") {
                            var foods = protocal.obj;
                            renderTable(foods);
                        }
                    }
                });
            });
            
            function renderTable(foods) {
            	var foodsBody = $("#foodsBody");
                foods.forEach(function(item, index, array) {
                    var foodId = item.foodId;
                    var foodName = item.foodName;
                    var foodPrice = item.foodPrice;
                    var foodPic = item.foodPic;
                    var foodTypeId = item.foodFoodTypeId;
                    var merchantId = item.merchantId;
                                
                    var tr = document.createElement("tr");
                    tr.innerHTML += "<td>" + foodId + "</td>";
                    tr.innerHTML += "<td>" + foodName + "</td>";
                    tr.innerHTML += "<td>" + foodPrice + "</td>";
                    tr.innerHTML += "<td><img src='" + foodPic + "' alt='图片无法显示' class='img-thumbnail' width=200px height=150px></td>";
                    tr.innerHTML += "<td>" + foodType[foodTypeId] + "</td>";
                    tr.innerHTML += "<td>Update</td>";
                    tr.innerHTML += "<td>Dalete</td>";
                    foodsBody.append(tr);
                });
            }
            
            function addReq() {}
            function updateReq() {}
            function deletereq() {}
            function uploadReq() {}
        })();